#include <stdio.h>
#define N 8
#define M 10

void fun(int *p, int *q, int *a) {
	int i = 0, j = 0, k = 0;
	while ((i < N) && (j < M))
		if (*(p + i) <= *(q + j)) {
			*(a + k) = *(p + i);
			i++;
			k++;
		} else {
			*(a + k) = *(q + j);
			j++;
			k++;
		}
	while (i < N) {
		*(a + k) = *(p + i);
		i++;
		k++;
	}
	while (j < M) {
		*(a + k) = *(q + j);
		j++;
		k++;
	}
}

void main() {
	int a[N], b[M], c[M + N] = {0}, i;
	for (i = 0; i < N; i++)
		scanf ("%d", &a[i]);
	for (i = 0; i < M; i++)
		scanf ("%d", &b[i]);
	fun(a, b, c);
	for (i = 0; i < M + N; i++)
		printf("%d\t", c[i]);
	printf("\n");
}
